#pragma once
#include <string>

#define _COMBINE1(X,Y) X##Y
#define _COMBINE(X,Y) _COMBINE1(X,Y)

/*! Use this macro in your file. it will initialize a timer variable ex. _profiler1(...)
 *  The timer will expire when it is out of scope.
 */
#define _PROFILER_MARK() timer::RefCountTimer _COMBINE(_profiler, __LINE__) ## (__FUNCSIG__, __FILE__, __LINE__)

namespace timer
{
	class RefCountTimer
	{
	public:
		/*! Constructor.
		 *  Starts the timer running. Parameter values are needed to print profiler diagnostic report
		 */
		RefCountTimer(const char *_FunctionSignature, const char *_FileName, const int &_LineNumber);

		/*! Destructor.
		 *  Stops the timer and adds the collected information to the ProfilerManager class
		 */
		~RefCountTimer(void);

	private:
		std::string m_key;
		const char * m_function_signature;
		const char * m_file_name;
		const int m_line_number;
		__int64 m_start;
		__int64 m_end;
		__int64 m_freq;
	};
}